package com.linhngua.code.data.shop;

import java.io.Serializable;
import java.util.Collection;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import com.linhngua.code.data.people.Customer;
import com.linhngua.code.data.people.Owner;

@Entity
public class Shop implements Serializable {
	
	/**
	 * 
	 */
	private static final long		serialVersionUID	= 1L;
	
	private int						id;
	
	private String					name;
	
	private Collection<Item>		items;
	
	private Collection<Customer>	recentCustomers;
	
	private Owner					owner;
	
	private int						viewCount;
	
	private int						likeCount;
	
	public Shop() {

		super();
		
	}
	
	@Id
	@GeneratedValue
	public int getId() {

		return id;
	}
	
	public void setId(int id) {

		this.id = id;
	}
	
	public String getName() {

		return name;
	}
	
	public void setName(String name) {

		this.name = name;
	}
	
	@OneToMany(cascade=CascadeType.ALL,mappedBy="shop")
	public Collection<Item> getItems() {

		return items;
	}
	
	public void setItems(Collection<Item> items) {

		this.items = items;
	}
	
	@OneToMany(cascade=CascadeType.ALL)
	@JoinColumn(name="Shop_id")
	public Collection<Customer> getRecentCustomers() {

		return recentCustomers;
	}
	
	public void setRecentCustomers(Collection<Customer> recentCustomers) {

		this.recentCustomers = recentCustomers;
	}
	
	@ManyToOne
	@JoinColumn(name="Owner_id",nullable=false)
	public Owner getOwner() {

		return owner;
	}
	
	public void setOwner(Owner owner) {

		this.owner = owner;
	}
	
	public int getViewCount() {

		return viewCount;
	}
	
	public void setViewCount(int viewCount) {

		this.viewCount = viewCount;
	}
	
	public int getLikeCount() {

		return likeCount;
	}
	
	public void setLikeCount(int likeCount) {

		this.likeCount = likeCount;
	}
	
}
